home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / graphics / 3dvect37.zip / MAIN.ASM < prev    next >
Assembly Source File  |  1994-06-22  |  33KB  |  849 lines

  1. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  2. ;
  3. ; Filename     : Main.asm
  4. ; Included from: Main Assembley Module
  5. ; Description  : Main demo of 3dvector library
  6. ;
  7. ; Written by: John McCarthy
  8. ;             1316 Redwood Lane
  9. ;             Pickering, Ontario.
  10. ;             Canada, Earth, Milky Way (for those out-of-towners)
  11. ;             L1X 1C5
  12. ;
  13. ; Internet/Usenet:  BRIAN.MCCARTHY@CANREM.COM
  14. ;         Fidonet:  Brian McCarthy 1:229/15
  15. ;   RIME/Relaynet: ->CRS
  16. ;
  17. ; Home phone, (905) 831-1944, don't call at 2 am eh!
  18. ;
  19. ; Send me your protected mode source code!
  20. ; Send me your Objects!
  21. ; But most of all, Send me a postcard!!!!
  22. ;
  23. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  24.  
  25.            .386p
  26.            jumps
  27.  
  28. code32     segment para public use32
  29.            assume cs:code32, ds:code32
  30.  
  31. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  32. ; define externals
  33. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  34.  
  35.            include pmode.ext       ; protected mode externals
  36.            include xmouse.ext      ; xmode mouse externals
  37.            include xmode.ext       ; xmode externals by matt pritchard
  38.            include 3d.ext
  39.            include irq.ext
  40.            include stars.ext
  41.            include font.ext
  42.            include file.ext
  43.            include land.ext
  44.            include argc.ext
  45.            include moveit.ext
  46.            include joystick.ext
  47.  
  48.            include macros.inc
  49.            include equ.inc
  50.  
  51.            include sphere.inc
  52.            include icon.inc
  53.            include gamecolr.inc    ; dac palette
  54.  
  55.            include objects.inc     ; table of shapes/colours
  56.            include stuff.inc       ; ending screen stuff
  57.            include sequence.inc    ; the animation
  58.  
  59.            include stone0.inc
  60.            include stone1.inc
  61.            include stone2.inc
  62.            include stone3.inc
  63.            include stone4.inc
  64.            include stone5.inc
  65.            include stone6.inc
  66.            include stone7.inc
  67.            include stone8.inc
  68.            include stone9.inc
  69.            include stonea.inc
  70.            include stoneb.inc
  71.            include stonec.inc
  72.            include stoned.inc
  73.            include stonee.inc
  74.            include stonef.inc
  75.  
  76. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  77. ; stuff for 669 load (if you have a GUS) check TRAN's HELLSRC.ZIP for support files
  78. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  79.  
  80.            include_GUS equ no
  81.  
  82.            if include_GUS eq yes
  83.            include \32\gsp669.ext
  84.            include \32\gs.ext
  85.            include \32\kb.ext
  86.            endif
  87.  
  88. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  89. ; code
  90. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  91.  
  92.            public _main
  93. _main:
  94.  
  95. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  96. ; get enviornment: current directory, current file
  97. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  98.  
  99.            sti
  100.            call setup_env          ; set up file envirionment (eg c:\temp\thisprog.exe )
  101.  
  102. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  103. ; check for and load 669 - link with argc,kb,gsp669,gs
  104. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  105.  
  106.            if include_GUS eq yes
  107.            call _gs_find           ; check for and load a .669
  108.            jc exiterr
  109.            mov edx,_lomembase      ; this code belongs to TRAN
  110.            xor al,al
  111.            call _cchekstr
  112.            jc exiterr
  113.            mov edx,_lomembase
  114.            call _openfile
  115.            jc exiterr
  116.            call _gsp669_init
  117.            mov eax,offset _readfile
  118.            mov edx,_lomembase
  119.            call _gsp669_load
  120.            call _closefile
  121.            call _gsp669_play
  122. exiterr:
  123.            endif
  124.  
  125. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  126. ; get timer IRQ running
  127. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  128.  
  129.            call set_pmirq          ; set irq running - must be done at start for palette fading
  130.  
  131. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  132. ; do the spaceship animation
  133. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  134.  
  135.           ;mov esi,offset animation1
  136.           ;mov edx,offset _standard_screen_draw
  137.           ;call animate_this
  138.           ;jmp getout
  139.  
  140. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  141. ; explode DOS palette to common colour
  142. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  143.  
  144.            mov eax,00003f00h       ; what color to fade to
  145.            mov bh,12               ; how much to fade each pel
  146.            mov bl,255              ; how often should i fade the palette
  147.            call _fade_all          ; fade it...
  148.            call _wait_for_fade
  149.  
  150. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  151. ; fade palette to black
  152. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  153.  
  154.            mov eax,00000000h       ; what color to fade to
  155.            mov bh,1                ; how much to fade each pel
  156.            mov bl,120              ; how often should i fade the palette
  157.            call _fade_all          ; fade it...
  158.            call _wait_for_fade
  159.  
  160. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  161. ; set xmode
  162. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  163.  
  164.            pushw xmode
  165.            pushw xactual
  166.            pushw yactual
  167.            pushw pages
  168.            call set_vga_modex
  169.            cmp ax,-1               ; test for error in setting videomode
  170.            jne getout
  171.  
  172. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  173. ; wipe palette after xmode call ('cause INT 10h resets the palette)
  174. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  175.  
  176.            mov eax,00000000h
  177.            call wipeoffpalette
  178.  
  179. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  180. ; set up pointers to object shape data
  181. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  182.  
  183.            call setupbase
  184.            call _calibrate_joystick
  185.  
  186. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  187. ; initialize xmode page flipping, font style, and get mouse ready
  188. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  189.  
  190.            call initpages
  191.            mov esi,o font0
  192.            mov edi,o font1
  193.            mov ebp,o fontlength
  194.            call initfont
  195.            call show_mouse
  196.  
  197. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  198. ; draw borders, title, and cosmetic screen stuff
  199. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  200.  
  201.            mov esi,o runscreen ; this uses the font.asm setup routines
  202.            call tstring
  203.            mov esi,o runtext
  204.            call tstring
  205.  
  206. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  207. ; use IRQ to fade palette on
  208. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  209.  
  210.            mov esi,o gamecolr
  211.            mov bh,1
  212.            mov bl,180
  213.            call _fade_palette_read
  214.  
  215. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  216. ; set clipping paramters (already done, but this shows how set new parameters)
  217. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  218.  
  219.            mov ax,xmin
  220.            mov bx,ymin
  221.            mov cx,xmax
  222.            mov dx,ymax
  223.            call set_clip_absolute
  224.  
  225. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  226. ; set clipping parameters, (these are already set on startup so this isnt really needed)
  227. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  228.  
  229.            mov ax,xmin
  230.            mov bx,ymin
  231.            mov cx,xmax
  232.            mov dx,ymax
  233.            mov si,xcenter
  234.            mov di,ycenter
  235.            call set_clip_offset
  236.  
  237. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  238. ; initialize the bitmaps: remember first two words are x and y size
  239. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  240.  
  241.            mov bitx   +4*0,15       ; base bitmap scaling
  242.            mov bity   +4*0,15
  243.            mov bitbase+4*0,o sphere
  244.            mov bitx   +4*1,15       ; base bitmap scaling
  245.            mov bity   +4*1,15
  246.            mov bitbase+4*1,o icon
  247.  
  248.            mov stonetbl[0*4],o headerf   ; stone texture table
  249.            mov stonetbl[1*4],o headere
  250.            mov stonetbl[2*4],o headerd
  251.            mov stonetbl[3*4],o headerc
  252.            mov stonetbl[4*4],o headerb
  253.            mov stonetbl[5*4],o headera
  254.            mov stonetbl[6*4],o header9
  255.            mov stonetbl[7*4],o header8
  256.            mov stonetbl[8*4],o header7
  257.            mov stonetbl[9*4],o header6
  258.            mov stonetbl[10*4],o header5
  259.            mov stonetbl[11*4],o header4
  260.            mov stonetbl[12*4],o header3
  261.            mov stonetbl[13*4],o header2
  262.            mov stonetbl[14*4],o header1
  263.            mov stonetbl[15*4],o header0
  264.  
  265. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  266. ; plop some objects in space
  267. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  268.  
  269. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  270. ; camera location/angle
  271. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  272.  
  273.            mov esi,cameraobject ; set the camera position
  274.            mov bx,0             ; camera angle
  275.            mov cx,0
  276.            mov bp,0
  277.            call set_angle
  278.            mov ebx,100000       ; camera position
  279.            mov ecx,25000
  280.            mov ebp,-915000
  281.            call put_object
  282.  
  283. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  284. ; cube
  285. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  286.  
  287.            call search_next_available_object ; return si as next available object (1)
  288.            call init_object
  289.            mov ebx,-260000      ; to this position (x,y,z)=ebx,ecx,ebp
  290.            mov ecx,650000       ; locations are 32 bit
  291.            mov ebp,0
  292.            call put_object      ; plop..
  293.            mov bx,0             ; angles are 16 bit
  294.            mov cx,0
  295.            mov bp,0
  296.            call set_angle       ; duhhh...i wonder what this call does...
  297.            call set_object_on   ; turn object si on (make visible)
  298.            call use_full_rotations ; full rotations for this object (0)
  299.            mov userotate[esi],0 ; full rotations for this object (0)
  300.            mov ax,0
  301.            call set_shape       ; set object si to shape ax
  302.            mov ebx,000545100h   ; x,y,z angular velocities
  303.            mov ecx,000a91500h   ; high word = number of turns/revolutions
  304.            mov ebp,000d42300h   ; lo word = final angle (position)
  305.            mov di,58000         ; di = time to twist there (total frames)
  306.            call twist_si        ; set angular velocity
  307.            call set_finala      ; set final anglular position (pre-calculation)
  308.            mov bl,0             ; set cross referencing palette (null)
  309.            call set_xref_palette
  310.  
  311.            mov xreftable[4],offset gtab
  312.  
  313. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  314. ; wireframe cube
  315. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  316.  
  317.            call search_next_available_object
  318.            call init_object
  319.            mov ebx,230000
  320.            mov ecx,0
  321.            mov ebp,190000
  322.            call put_object
  323.            mov bx,0
  324.            mov cx,0
  325.            mov bp,0
  326.            call set_angle
  327.            call set_object_on
  328.            call use_full_rotations ; full rotations for this object (0)
  329.            mov ax,1
  330.            call set_shape
  331.            mov ebx,000000000h
  332.            mov ecx,000000000h
  333.            mov ebp,000300000h
  334.            mov di,65500
  335.            call twist_si
  336.            call set_finala
  337.            mov bl,0
  338.            call set_xref_palette
  339.  
  340. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  341. ; ring
  342. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  343.  
  344.            call search_next_available_object
  345.            call init_object
  346.            mov ebx,80000
  347.            mov ecx,170000
  348.            mov ebp,80000
  349.            call put_object
  350.            mov bx,0
  351.            mov cx,0
  352.            mov bp,0
  353.            call set_angle
  354.            call set_object_on
  355.            call use_full_rotations ; full rotations for this object (0)
  356.            mov ax,2
  357.            call set_shape
  358.            mov ebx,000310124h
  359.            mov ecx,0ffbc2340h
  360.            mov ebp,000530100h
  361.            mov di,16000
  362.            call twist_si
  363.            call set_finala
  364.            mov bl,0
  365.            call set_xref_palette
  366.  
  367. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  368. ; diamond
  369. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  370.  
  371.            call search_next_available_object
  372.            call init_object
  373.            mov ebx,80000
  374.            mov ecx,-200000
  375.            mov ebp,-80000
  376.            call put_object
  377.            mov bx,0
  378.            mov cx,0
  379.            mov bp,0
  380.            call set_angle
  381.            call set_object_on
  382.            call use_full_rotations ; full rotations for this object (0)
  383.            mov ax,3
  384.            call set_shape
  385.            mov ebx,000600000h
  386.            mov ecx,0fff23400h
  387.            mov ebp,000100000h
  388.            mov di,21000
  389.            call twist_si
  390.            call set_finala
  391.            mov bl,0
  392.            call set_xref_palette
  393.  
  394. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  395. ; rubine (flat diamond)
  396. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  397.  
  398.            call search_next_available_object
  399.            call init_object
  400.            mov ebx,-190000
  401.            mov ecx,130000
  402.            mov ebp,-240000
  403.            call put_object
  404.            mov bx,0
  405.            mov cx,0
  406.            mov bp,0
  407.            call set_angle
  408.            call set_object_on
  409.            call use_full_rotations ; full rotations for this object (0)
  410.            mov ax,4
  411.            call set_shape
  412.            mov ebx,000200000h
  413.            mov ecx,000100000h
  414.            mov ebp,0ffa00000h
  415.            mov di,12000
  416.            call twist_si
  417.            call set_finala
  418.            mov bl,0
  419.            call set_xref_palette
  420.  
  421. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  422. ; vectorball cube thingy
  423. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  424.  
  425.            call search_next_available_object ; this next object is the bitmaped cube
  426.            call init_object
  427.            mov ebx,-150000      ; remove this and see the speed of
  428.            mov ecx,-130000      ; only vectors
  429.            mov ebp,120000
  430.            call put_object      ; note: the bitmaps take a lot of cpu time
  431.            mov bx,0
  432.            mov cx,0
  433.            mov bp,0
  434.            call set_angle
  435.            call set_object_on
  436.            call use_full_rotations ; full rotations for this object (0)
  437.            mov ax,5
  438.            call set_shape
  439.            mov ebx,000300000h
  440.            mov ecx,000700000h
  441.            mov ebp,000500000h
  442.            mov di,13000
  443.            call twist_si
  444.            call set_finala
  445.  
  446. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  447. ; stand alone bitmap
  448. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  449.  
  450.            call search_next_available_object ; stand alone bitmap - good for smoke or
  451.            call init_object
  452.            mov ebx,-5000        ; explosions
  453.            mov ecx,5000
  454.            mov ebp,25000
  455.            call put_object      ; set location
  456.            call set_object_on   ; turn it on
  457.            mov ax,0             ; zeroth bitmap is shape
  458.            call set_shape       ; will load from bitbase[0]
  459.            call set_to_hibitmap ; it's a bitmap...
  460.            mov bx,50            ; bitmap scaling (gets added to bitx and bity)
  461.            mov cx,50            ; bitmap scaling bx=x scaling, cx=y scaling
  462.            call set_bitmap_scaling
  463.  
  464. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  465. ; this is the body of those wierd three blocks
  466. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  467.  
  468.            call search_next_available_object
  469.            call init_object
  470.            mov ebx,-190000
  471.            mov ecx,-180000
  472.            mov ebp,-140000
  473.            call put_object
  474.            mov bx,0
  475.            mov cx,0
  476.            mov bp,0
  477.            call set_angle
  478.            call set_object_on
  479.            call use_full_rotations
  480.            mov ax,6
  481.            call set_shape
  482.            mov ebx,000600000h
  483.            mov ecx,0fff23400h
  484.            mov ebp,000200000h
  485.            mov di,16000
  486.            call twist_si
  487.            call set_finala
  488.            mov bl,0
  489.            call set_xref_palette
  490.  
  491. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  492. ; this defines one "arm" of that wierd block - remember, it is "attached" to the body above
  493. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  494.  
  495.            inc esi
  496.            call init_object
  497.            mov ebx,0/256        ; this is not an actual object, it is only
  498.            mov ecx,0/256        ; a reference to where the arm will get
  499.            mov ebp,0/256        ; the angle data from.
  500.            call put_object      ; put_object sets location of arm relative to body
  501.            mov bx,0
  502.            mov cx,0
  503.            mov bp,0
  504.            call set_angle       ; set initial angle of arm (relative to body)
  505.            call set_object_off
  506.            call set_sub_object_on
  507.            call use_full_rotations ; full = rotation is relative to body , no = arm angle is not relative to body
  508.           ;mov ax,xx            ; arm shape is already defined in block above
  509.           ;call set_shape
  510.            mov ebx,000200000h   ; set anglular velocity of arm (relative to body)
  511.            mov ecx,000600000h
  512.            mov ebp,000120000h
  513.            mov di,22000
  514.            call twist_si
  515.            call set_finala       ; set final angle of arm (when it finally stops)
  516.            mov bl,0              ; not an object, just angle and location data
  517.            call set_xref_palette ; so we dont need this
  518.  
  519. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  520. ; this defines the other "arm"
  521. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  522.  
  523.            inc esi
  524.            call init_object
  525.            mov ebx,0/256        ; the locations of sub_objects are /256 because of the way
  526.            mov ecx,0/256        ; conversion between real space co-ordinates and object
  527.            mov ebp,0/256        ; co-ordinates are calculated.  objects are 256 times larger than their appearance in real space
  528.            call put_object      ; this is because there is greater accuracy in real space!!
  529.            mov bx,0
  530.            mov cx,0
  531.            mov bp,0
  532.            call set_angle
  533.            call set_object_off
  534.            call set_sub_object_on
  535.            call use_full_rotations ; full = rotation is relative to body , no = arm angle is not relative to body
  536.           ;mov ax,xx
  537.           ;call set_shape
  538.            mov ebx,000220000h
  539.            mov ecx,0ff700000h
  540.            mov ebp,0ffe30000h
  541.            mov di,18000
  542.            call twist_si
  543.            call set_finala
  544.            mov bl,0
  545.            call set_xref_palette
  546.  
  547. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  548. ; make camera rotate along z axis if you want - make sure equ.inc has "use_z equ yes"
  549. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  550.  
  551.           ;mov eyezadds,50      ; make the camera rotate along it's z axis (just for fun)
  552.           ;mov esi,cameraobject
  553.           ;call set_finala
  554.  
  555. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  556. ; reset IRQ counter before animation begins
  557. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  558.  
  559.            call reset_raster_count   ; done before any animation loop!!!
  560.  
  561. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  562. ; intialize 3d pointers\indexers\sortvalues
  563. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  564.  
  565.            call init_tables          ; initialize 3d vector stuff
  566.  
  567. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  568. ; example of how to point an object toward another object in a certin time
  569. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  570.  
  571.           ;mov esi,5                 ; an example of how to use point_time
  572.           ;mov ebx,-10000            ; si = obj, bx,cx,bp = location, di = time
  573.           ;mov ecx,-30000
  574.           ;mov ebp,90000
  575.           ;mov edi,150
  576.           ;call point_time
  577.  
  578. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  579. ; THE MAIN LOOP...
  580. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  581.  
  582. ieox:
  583.  
  584. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  585. ; point an object toward the camera (just a cheap example)
  586. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  587.  
  588.           ;mov si,3                  ; try uncommenting this!, this will point
  589.           ;mov di,cameraobject       ; the red ring at the camera.
  590.           ;call point_it
  591.  
  592. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  593. ; debugging tool: would you believe some idiot actually called me to tell me I
  594. ;                 needed more debugging tools - I told him he  needs  to  stop
  595. ;                 writing programs with bugs...
  596. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  597.  
  598.           ;mov eax,your_problem     ; debugging tool                                                    mov eax,your_problem      ; debugging tool!!!!
  599.           ;mov number_eax,eax
  600.            call put_at_top
  601.  
  602. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  603. ; make sun move around
  604. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  605.  
  606.           ;add y_angle_of_sun,150    ; watch the red ring carefully! the sun will move around the room!
  607.  
  608. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  609. ; make camera respond to joystick
  610. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  611.  
  612.            call _cartisian_joystick
  613.  
  614.            neg ebx         ; makes the joystick like an airplane...sorta...
  615.            shr eax,6
  616.            shr ebx,6
  617.            imul eax,_old_traces_past
  618.            imul ebx,_old_traces_past
  619.            add eyeax,bx
  620.            add eyeay,ax
  621.            call fix_xangleq ; make it so user doesn wrap around upside down. (so stars wont mess up)
  622.  
  623.            call _justgetbutton
  624.            test eax,2 ; test if second button pressed
  625.            jz dobut2
  626.  
  627.            and eax,1
  628.            xor eax,1
  629.            imul eax,12000
  630.  
  631.            mov esi,cameraobject      ; move camera...esi - object
  632.            mov ebp,eax               ; ebp = speed (make it faster!)
  633.            mov edi,10                ; edi = total time (not in calculation)
  634.            call set_speed            ; move object in direction it is pointing
  635.            call set_finall           ; then calculate final position (not important as long as it keeps moving)
  636.            jmp contxx
  637. dobut2:
  638.            and eax,2
  639.            shr eax,1
  640.            xor eax,1
  641.            imul eax,-12000           ; if button 2 pressed, move camera backwards
  642.  
  643.            mov esi,cameraobject      ; move camera...esi - object
  644.            mov ebp,eax               ; ebp = speed (make it faster!)
  645.            mov edi,10                ; edi = total time (not in calculation)
  646.            call set_speed            ; move object in direction it is pointing
  647.            call set_finall           ; then calculate final position (not important as long as it keeps moving)
  648. contxx:
  649.  
  650. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  651. ; set camera rotation matrix - done once per frame so other routines know how to plot objects
  652. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  653.  
  654.            call setsincose           ; set rotation multipliers for eye
  655.           ;call draw_landscape       ; draw background landscape
  656.            call clear_fill           ; clear video memory before plot
  657.  
  658. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  659. ; plot the stars in the background
  660. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  661.  
  662.            call show_stars           ; plot background stars
  663.  
  664. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  665. ; plot all objects on screen
  666. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  667.  
  668.            call makeobjs             ; plot all objects in sides table
  669.  
  670. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  671. ; plot mouse on screen - only a 1 page mouse so it flickers on two pages
  672. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  673.  
  674.           ;call instant_mouse        ; plot mouse on screen
  675.  
  676. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  677. ; show how long it took to draw that last screen
  678. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  679.  
  680.           ;mov eax,traces_past       ; show number of traces past per re-draw
  681.           ;mov number_eax,eax
  682.           ;call put_at_top
  683.  
  684. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  685. ; show user the new screen
  686. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  687.  
  688.            call flip_page            ; flip video pages
  689.  
  690. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  691. ; update vector positions/angles
  692. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  693.  
  694.            call updvectors           ; move objects around, rotate them
  695.  
  696. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  697. ; test escape key - if none, return to top of main loop
  698. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  699.  
  700.            in al,60h                 ; test keyboard
  701.            cmp al,1
  702.            jne ieox
  703. ieox2:
  704.            in al,60h                 ; test keyboard
  705.            cmp al,1
  706.            je ieox2
  707. getout:
  708.  
  709. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  710. ; make endpage screen
  711. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  712.  
  713.            mov eax,0
  714.            mov bh,1
  715.            mov bl,200
  716.            call _fade_all
  717.            call _wait_for_fade
  718.  
  719.            call mode03
  720.            mov  eax,0
  721.            call wipeoffpalette
  722.  
  723.            mov  edx,offset endtext
  724.            call _putdosmsg
  725.  
  726.            mov esi,o _default_palette
  727.            mov bh,2
  728.            mov bl,255
  729.            call _fade_palette_read
  730.            call _wait_for_fade
  731.  
  732.            call reset_pmirq  ; reset irq vectors
  733.  
  734.            if include_GUS eq yes
  735.            call _gsp669_uninit
  736.            endif
  737.  
  738.            jmp _exit
  739.  
  740. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  741. ; sample routines to show how to use some routines
  742. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  743.  
  744. comment %
  745.            push offset gamecolr
  746.            pushw 0
  747.            pushw 255
  748.            pushw 1
  749.            call load_dac_registers
  750. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  751.  
  752.            mov esi,04       ; esi = object
  753.            mov edi,55       ; edi = time to get there (# of frames)
  754.            call newfollow
  755. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  756.  
  757.            mov ebx,x
  758.            mov ecx,y
  759.            mov ebp,z
  760.            mov edi,time
  761.            mov esi,cameraobject
  762.            call move_si
  763.            call set_finall
  764. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  765.  
  766.            block 0,0,319,399,14
  767.            call flip_page
  768.            block 0,0,319,399,14
  769. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  770.  
  771.            call flip_page    ; example of how to draw a single polygon
  772.  
  773.            p1x equ -50
  774.            p1y equ -50
  775.            p2x equ -90
  776.            p2y equ 70
  777.            p3x equ 60
  778.            p3y equ 80
  779.  
  780.            mov x1,p1x
  781.            mov y1,p1y
  782.            mov x2,p2x
  783.            mov y2,p2y
  784.            call fakeline
  785.  
  786.            mov x1,p2x
  787.            mov y1,p2y
  788.            mov x2,p3x
  789.            mov y2,p3y
  790.            call fakeline
  791.  
  792.            mov x1,p3x
  793.            mov y1,p3y
  794.            mov x2,p1x
  795.            mov y2,p1y
  796.            call fakeline
  797.  
  798.            mov colq,7
  799.            mov steel,-1
  800.            call poly_fill
  801.  
  802.            call flip_page
  803.  
  804. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  805.  
  806.            mov si,6                  ; move cube around...si - object
  807.            mov ebp,45000             ; ebp = speed (make it faster!)
  808.            mov di,600                ; di = total time (not in calculation)
  809.            call set_speed            ; move object in direction it is pointing
  810.            call set_finall           ; then calculate final position (not important as long as it keeps moving)
  811. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  812. %
  813.  
  814. gtab       db 010h,011h,012h,013h,014h,015h,016h,017h
  815.            db 018h,019h,01ah,01bh,01ch,01dh,01eh,01fh
  816.            db 011h,012h,013h,014h,015h,016h,017h,018h
  817.            db 019h,01ah,01bh,01ch,01dh,01eh,01fh,01fh
  818.            db 010h,011h,012h,013h,014h,015h,016h,017h
  819.            db 018h,019h,01ah,01bh,01ch,01dh,01eh,01fh
  820.            db 010h,011h,012h,013h,014h,015h,016h,017h
  821.            db 018h,019h,01ah,01bh,01ch,01dh,01eh,01fh
  822.            db 010h,011h,012h,013h,014h,015h,016h,017h
  823.            db 018h,019h,01ah,01bh,01ch,01dh,01eh,01fh
  824.            db 010h,011h,012h,013h,014h,015h,016h,017h
  825.            db 018h,019h,01ah,01bh,01ch,01dh,01eh,01fh
  826.            db 010h,011h,012h,013h,014h,015h,016h,017h
  827.            db 018h,019h,01ah,01bh,01ch,01dh,01eh,01fh
  828.            db 010h,011h,012h,013h,014h,015h,016h,017h
  829.            db 018h,019h,01ah,01bh,01ch,01dh,01eh,01fh
  830.            db 010h,011h,012h,013h,014h,015h,016h,017h
  831.            db 018h,019h,01ah,01bh,01ch,01dh,01eh,01fh
  832.            db 010h,011h,012h,013h,014h,015h,016h,017h
  833.            db 018h,019h,01ah,01bh,01ch,01dh,01eh,01fh
  834.            db 010h,011h,012h,013h,014h,015h,016h,017h
  835.            db 018h,019h,01ah,01bh,01ch,01dh,01eh,01fh
  836.            db 010h,011h,012h,013h,014h,015h,016h,017h
  837.            db 018h,019h,01ah,01bh,01ch,01dh,01eh,01fh
  838.            db 010h,011h,012h,013h,014h,015h,016h,017h
  839.            db 018h,019h,01ah,01bh,01ch,01dh,01eh,01fh
  840.            db 010h,011h,012h,013h,014h,015h,016h,017h
  841.            db 018h,019h,01ah,01bh,01ch,01dh,01eh,01fh
  842.            db 010h,011h,012h,013h,014h,015h,016h,017h
  843.            db 018h,019h,01ah,01bh,01ch,01dh,01eh,01fh
  844.            db 010h,011h,012h,013h,014h,015h,016h,017h
  845.            db 018h,019h,01ah,01bh,01ch,01dh,01eh,01fh
  846.  
  847. code32     ends
  848.            end
  849.